/*Joseph A. Coll
6/4/2025
Cleaning 2024 ANES for Political Disenfranchisement?*/


use "anes_timeseries_2024_stata_20250430.dta", clear

*Political Interest to Politics/Elections
tab V241004
tab V241004, nol
recode V241004 (1=4 "High") (2=3 "Moderately High") (3=2 "Moderately Low") (-9 4/5 =1 "Low"), gen(poli_int_politics)
label var poli_int_politics "Political Interest"
tab poli_int_politics

*Ideology
tab V241177
tab V241177, nol
recode V241177 (1=1 "V. Lib.") (2=2 "Lib.") (3=3 "S. Lib.") (-9/-1 4 99= 4 "Moderate") (5=5 "S. Cons.") (6=6 "Cons.") (7=7 "V. Cons."), gen(conservativism)
label var conservativism Conservativism
tab conservativism

recode V241177 (1/3=1 "Liberal") (-9/-1 4 99= 2 "Moderate") (5/7=3 "Conservative"), gen(conservativism3)
label var conservativism3 Conservativism
tab conservativism3

*Age
tab V241458x
sum V241458x if V241458x !=-9
recode V241458x (-9/-1=52), gen(age)
label var age Age
tab age

gen age2 =age *age
label var age2 "Age Squared"
tab age2

*Education
tab V241463
tab V241463, nol
tab V241463 if V241463 <95 & V241463 >0
sum V241463 if V241463 <95 & V241463 >0
recode V241463 (1/8=1 "<HS") (9=2 "HS Grad.") (10=3 "Some Coll.") (-9/-1 11/12 95=4 "Assoc.") (13=5 "Bach.") (14=6 "MA") (15/16=7 "Adv."), gen(educ)
label var educ Education
tab educ

*Latino
tab V241499
tab V241499, nol
recode V241499 (1=1 "Latino") (-9/-1 2=0 "Not Latino"), gen(hispanic)
replace hispanic = 1 if V241501x ==3
label var hispanic Hispanic
tab hispanic

*Race
tab V241501x
recode V241501x (1=1 "White") (-9/-1 2/6=0 "Not White"), gen(white_non_hispanic)
label var white_non_hispanic "White"
tab white_non_hispanic

tab V241501x
recode V241501x (2=1 "Black") (-9/-1 1 3/6=0 "Not Black"), gen(black_non_hispanic)
label var black_non_hispanic "Black"
tab black_non_hispanic

tab V241501x
recode V241501x (-9/-1 1 4/6=1 "Other Race") (1 2 3=0 "Not Other Race"), gen(other_non_hispanic)
label var other_non_hispanic "Other Race"
tab other_non_hispanic

*Income
tab V241566x
sum V241566x if V241566x >0
recode V241566x  (1/2=1 "<10k") (3/4=2 "10-15") (5/6=3 "15-20") (7/8=4 "20-25") (9/10=5 "25-30") (11=6 "30-35") (12=7 "35-40") (13=8 "40-45") (14=9 "45-50") (15/16=10 "50-60") (17=11 "60-65") (18=12 "65-70") (19=13 "70-75") (20=14 "75-80") (21=15 "80-90") (22=16 "90-100")(23=17 "100-110") (24=18 "110-125") (25=19 "125-150") (26=20 "150-175") (27=21 "175-250") (28=22 ">250"), gen(income_mean)
recode income_mean (-9/-1=7)           
label var income_mean Income
tab income_mean 

*Party
tab V241227x
recode V241227x (1/2=1 "Democrat") (-9/-1 3/7=0 "Not Democrat"), gen(dem_no_lean)
label var dem_no_lean Democrat
tab dem_no_lean

recode V241227x (1/3=1 "Democrat") (-9/-1 4/7=0 "Not Democrat"), gen(dem_w_lean)
label var dem_w_lean "Democrat"
tab dem_w_lean 

recode V241227x (-9/-1 4=1 "Independent") (1/3 5/7=0 "Not Independent"), gen(ind_nolean)
label var ind_nolean"Independent"
tab ind_nolean

recode V241227x (3/5=1 "Independent") (-9/-1 1/2 6/7=0 "Not Independent"), gen(ind_w_lean)
label var ind_w_lean Independent
tab ind_w_lean

recode V241227x (6/7=1 "Republican") (-9/-1 1/5=0 "Not Republican"), gen(rep_no_lean)
label var rep_no_lean Republican
tab rep_no_lean

recode V241227x (5/7=1 "Republican") (-9/-1 1/4=0 "Not Republican"), gen(rep_w_lean)
label var rep_w_lean "Republican"
tab rep_w_lean 

recode V241227x (1=1 "Strong Dem.") (2=2 "Mod. Dem.") (3=3 "Lean Dem.") (4=4 "Independent") (5=5 "Lean Rep.") (6=6 "Mod. Rep.") (7=7 "Strong Rep.") (-9/-1=.), gen(party_scale)
label var party_scale "Party"
tab party_scale

*Black Feeling Thermometer
tab V242516
sum V242516 if V242516 >-1
recode V242516 (-9/-1 200 =71), gen (ft_black)
label var ft_black "Black Affect"
tab ft_black 

*Black influence in politics
tab V242527
tab V242527, nol m
recode V242527 (-9/-1=.) (1=3 "B.A. Have too Much Influence") (2=2 "B.A. Have Right Amount of Influence") (3=1 "B.A. Have Too Little Influence"), gen(black_influence)
label var black_influence "Black American Political Influence"
tab black_influence

*White influence in politics
tab V242526
tab V242526, nol m
recode V242526 (-9/-1=.) (1=3 "W.A. Have too Much Influence") (2=2 "W.A. Have Right Amount of Influence") (3=1 "W.A. Have Too Little Influence"), gen(white_influence)
label var white_influence "White American Political Influence"
tab white_influence

*Political influence difference
gen black_white_influence5 = .
replace black_white_influence5 = black_influence - white_influence
label var black_white_influence5 "Black-White Political Influence"
replace black_white_influence5 = black_white_influence5  +3
fre black_white_influence5
label def black_white_influence5 1 "White way too much" 2 "White too much" 3 "Even" 4 "Black too much" 5 "Black way too much", replace
label val black_white_influence5 black_white_influence5 
fre black_white_influence5 

recode black_white_influence5 (1/2=1 "Low Poli. Threat") (3=2 "Moderate Poli. Threat") (4/5=3 "High Poli. Threat"), gen(black_white_influence3)
label var black_white_influence3 "Political Threat"

*Racial resentment
tab V242300 
tab V242300, nol
recode V242300 (1=5 "Agree Strongly") (2=4 "Agree Somewhat") (3=3 "Neither") (4=2 "Disagree Somehwat") (5=1 "Disagree Strongly") (-9/-1=.), gen(racism_nofavors)
label var racism_nofavors "Blacks Should Work w/o Special Favors"
tab racism_nofavors

tab V242301 
tab V242301, nol
recode V242301 (1=1 "Agree Strongly") (2=2 "Agree Somewhat") (3=3 "Neither") (4=4 "Disagree Somehwat") (5=5 "Disagree Strongly") (-9/-1=.), gen(racism_slaverydifficult)
label var racism_slaverydifficult "Slavery/Discrim. Limit Blacks (rev.)"
tab racism_slaverydifficult

tab V242302 
tab V242302, nol
recode  V242302 (1=1 "Agree Strongly") (2=2 "Agree Somewhat") (3=3 "Neither") (4=4 "Disagree Somehwat") (5=5 "Disagree Strongly") (-9/-1=.), gen(racism_dontgetless)
label var racism_dontgetless "Blacks Get Less (rev.)"
tab racism_dontgetless

tab V242303
tab V242303, nol
recode V242303 (1=5 "Agree Strongly") (2=4 "Agree Somewhat") (3=3 "Neither") (4=2 "Disagree Somehwat") (5=1 "Disagree Strongly") (-9/-1=.), gen(racism_blacksshouldtry)
label var racism_blacksshouldtry "Blacks Should Try Harder"
tab racism_blacksshouldtry

gen racism_scale2_1= .
replace racism_scale2_1 = (racism_nofavors + racism_slaverydifficult + racism_dontgetless + racism_blacksshouldtry)-4
label var racism_scale2_1 "Racial Resentment"
tab racism_scale2_1 

*Stereotypes
	*Hard working
	tab V242541
	tab V242541 if white_non ==1 
	recode V242541 (1=1 "Hard-working") (2=2) (3=3) (4=4 ) (5=5) (6=6) (7=7 "Lazy") (-9/-1=.), gen(stereo_white_lazy)
	label var stereo_white_lazy "White Lazy" 
	tab stereo_white_lazy

	tab V242542
	tab V242542 if white_non ==1 
	recode V242542 (1=1 "Hard-working") (2=2) (3=3) (4=4 ) (5=5) (6=6) (7=7 "Lazy") (-9/-1=.), gen(stereo_black_lazy)
	label var stereo_black_lazy "Black Lazy" 
	tab stereo_black_lazy

	*Differences 
	gen stereo_lazy_black_diff = .
	replace stereo_lazy_black_diff  = stereo_white_lazy - stereo_black_lazy if white_non ==1
	tab stereo_lazy_black_diff
	recode stereo_lazy_black_diff (-6/-1=1 "Black Lazier") (0=0 "Same") (1/6=-1 "White Lazier"), gen(stereo_lazy_black_diff3)
	label var stereo_lazy_black_diff3 "Black Lazier"
	tab stereo_lazy_black_diff3

	*Violent
	tab V242545
	tab V242545 if white_non ==1 
	recode V242545 (1=1 "Peaceful") (2=2) (3=3) (4=4 ) (5=5) (6=6) (7=7 "Violent") (-9/-1=.), gen(stereo_white_violent)
	label var stereo_white_violent "White Violent" 
	tab stereo_white_violent

	recode V242545 (1/3=-1 "Peaceful") (4=0 "Neither") (5/7=1 "Violent") (-9/-1=.), gen(stereo_white_violent3)
	label var stereo_white_violent3 "White Violent" 
	tab stereo_white_violent3

	tab V242546
	tab V242546 if white_non ==1 
	recode V242546 (1=1 "Peaceful") (2=2) (3=3) (4=4 ) (5=5) (6=6) (7=7 "Violent") (-9/-1=.), gen(stereo_black_violent)
	label var stereo_black_violent "Symbolic Threat" 
	tab stereo_black_violent

	recode V242546 (1/3=-1 "Peaceful") (4=0 "Neither") (5/7=1 "Violent") (-9/-1=.), gen(stereo_black_violent3)
	label var stereo_black_violent3 "Symbolic Threat" 
	tab stereo_black_violent3

	*Differences 
	gen stereo_violent_black_diff = .
	replace stereo_violent_black_diff  = stereo_black_violent -  stereo_white_violent if white_non ==1
	label var stereo_violent_black_diff "Symbolic Threat"	
	tab stereo_violent_black_diff
	clonevar stereo_violent_black_diff_orig = stereo_violent_black_diff
	recode stereo_violent_black_diff (-6/-1=1 "White More Violent") (0=2 "Same") (1/6=3 "Black More Violent"), gen(stereo_violent_black_diff3)
	tab stereo_violent_black_diff3
	label var stereo_violent_black_diff3 "Symbolic Threat"	

*Economic threat whites lose jobs to minorities
fre V242519
recode V242519 (1=5 "Extremely likely") (2=4 "Very likely") (3=3 "Moderately likely") (4=2 "Slightly likely") (5=1 "Not at all likely") (-9/-1=.), gen(whites_lose_jobs5)
label var whites_lose_jobs5 "Economic Threat"
fre whites_lose_jobs5

recode V242519 (1/3=3 "Highly likely") (4=2 "Moderately likely") (5=1 "Not at all likely") (-9/-1=.), gen(whites_lose_jobs3)
label var whites_lose_jobs3 "Economic Threat"
fre whites_lose_jobs3

*Immigrants commit crimes
fre V242231x
clonevar ii_crime = V242231x
recode ii_crime (-7/-1=.) (5/7=4)
revrs ii_crime 
fre revii_crime 
label var revii_crime  "Illegal Immig. Increases Crime"
drop ii_crime 
rename revii_crime ii_crime 
fre ii_crime

*Support for Felon Disenfranchisment
tab V241320 
tab V241320, nol
recode V241320 (1=1 "Opposes FD") (2=3 "Supports FD") (-9 -8 3=2 "Neither"), gen(supports_fd)
label var supports_fd "Supports Felon Disenf."
tab supports_fd

revrs supports_fd
fre revsupports_fd

tab V241322x
tab V241322x, nol
recode V241322x (1=1 "Opposes Greatly") (2=2 "Opposes Moderately") (3=3 "Opposes a Little") (-9/-1 4=4 "Neither") (5=5 "Favors a Little") (6=6 "Favors Moderately") (7=7 "Favors Greatly"), gen(supports_fd_scale)
label var supports_fd_scale "Felon Disenf. Support Scale"
tab supports_fd_scale

/*White Racial Importance (currently restricted)
tab V242531
tab V242531, nol
tab V242531 if white_non == 1
recode V242531 (1=5 "Extremely Important") (2=4 "Very Important") (3=3 "Moderately Important") (4=2 "A Little Important") (5=1 "Not at all Important") (-9/-1=.), gen(racial_importance)
label var racial_importance "Racial Importance"
tab racial_importance
*/

*Spending on Crime
tab V241272x 
tab V241272x, nol
recode V241272x (1=5 "Increase a Lot") (2=4 "Increase a Little") (3=3 "Kept the Same") (4=2 "Decreased a Little") (5=1 "Decreased a Lot") (-9/-1 . =3), gen(spending_crime)
label var spending_crime "+Crime Spending"

*State
fre V243001
bro if V243001 == " "
tab V243001, nol
statastates, abbreviation(V243001)
replace state_name = proper(state_name)
rename V243001 state_abbrev
fre state_abbrev
tab _merge
drop _merge

gen year = 2024

*Percent black
merge m:m state_abbrev year using "Percent Black by State.dta", gen(_mergePercBlack)
bro if _mergePercBlack !=3

gen fd_policy = .		
replace fd_policy = 1 if state_name == "District of Columbia"
replace fd_policy = 1 if state_name == "Maine"
replace fd_policy = 1 if state_name == "Vermont"
replace fd_policy= 2 if state_name == "California"
replace fd_policy= 2 if state_name == "Colorado"
replace fd_policy= 2 if state_name == "Connecticut"
replace fd_policy= 2 if state_name == "Hawaii"
replace fd_policy= 2 if state_name == "Illinois"
replace fd_policy= 2 if state_name == "Indiana"
replace fd_policy= 2 if state_name == "Maryland"
replace fd_policy= 2 if state_name == "Massachusetts"
replace fd_policy= 2 if state_name == "Michigan"
replace fd_policy= 2 if state_name == "Minnesota"
replace fd_policy= 2 if state_name == "Montana"
replace fd_policy= 2 if state_name == "Nevada"
replace fd_policy= 2 if state_name == "New Hampshire"
replace fd_policy= 2 if state_name == "New Jersey"
replace fd_policy= 2 if state_name == "New York"
replace fd_policy= 2 if state_name == "New Mexico"
replace fd_policy= 2 if state_name == "North Dakota"
replace fd_policy= 2 if state_name == "Ohio"
replace fd_policy= 2 if state_name == "Oregon"
replace fd_policy= 2 if state_name == "Pennsylvania"
replace fd_policy= 2 if state_name == "Rhode Island"
replace fd_policy= 2 if state_name == "Utah"
replace fd_policy= 2 if state_name == "Washington"
replace fd_policy= 3 if state_name == "Alaska"
replace fd_policy= 3 if state_name == "Arkansas"
replace fd_policy= 3 if state_name == "Georgia"
replace fd_policy= 3 if state_name == "Idaho"
replace fd_policy= 3 if state_name == "Kansas"
replace fd_policy= 3 if state_name == "Louisiana"
replace fd_policy= 3 if state_name == "Missouri"
replace fd_policy= 3 if state_name == "Nebraska"
replace fd_policy= 3 if state_name == "North Carolina"
replace fd_policy= 3 if state_name == "Oklahoma"
replace fd_policy= 3 if state_name == "South Carolina"
replace fd_policy= 3 if state_name == "South Dakota"
replace fd_policy= 3 if state_name == "Texas"
replace fd_policy= 3 if state_name == "West Virginia"
replace fd_policy= 3 if state_name == "Wisconsin"
replace fd_policy= 4 if state_name == "Alabama"
replace fd_policy= 4 if state_name == "Arizona"
replace fd_policy= 4 if state_name == "Delaware"
replace fd_policy= 4 if state_name == "Florida"
replace fd_policy= 4 if state_name == "Iowa"
replace fd_policy= 4 if state_name == "Kentucky"
replace fd_policy= 4 if state_name == "Mississippi"
replace fd_policy= 4 if state_name == "Tennessee"
replace fd_policy= 4 if state_name == "Virginia"
replace fd_policy= 4 if state_name == "Wyoming"
label def fd_policy 1 "No Disenfranchisement" 2 "During Incarceration" 3 "Until Sentence Completion" 4 "Post-Sentence Waiting Period/Additional Action"
label val fd_policy fd_policy
label var fd_policy "FDPolicy"

replace year = 2020
merge m:m state_name year using "Legislative Diversity Data Cleaned and Collapsed.dta", gen(_mergeSLD)
drop _mergeSLD
replace year = 2024

fre V240002a
recode V240002a (2=1 "Self-Administered") (1 3/4=0 "Not Self-Administered"), gen(survey_mode)
label def survey_mode 1 "SA" 0 "Non-SA", replace
label val survey_mode survey_mode 
label var survey_mode "Survey Mode"
fre survey_mode 

tab black_white_influence3 survey_mode , col chi


*Weight
clonevar post_weight = V240107b
clonevar pre_weight = V240107a

*Drop non-white respondents or those who did not answer main IV questions
drop if white_non_hispanic !=1
drop if black_influence == .

save "Political Racial Threat White Disenfranchisement Support Data 2024 Cleaned.dta", replace

